package cn.dmoncat.util.influx.config;

import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.InfluxDBClientFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * InfluxDB配置
 *
 * @author 延晓磊
 * @since 2024年07月03日
 */
@Configuration
public class InfluxConfig {

	@Resource
	private InfluxProperties influxProperties;

	/**
	 * InfluxDB客户端
	 */
	@Bean
	public InfluxDBClient influxDBClient() {
		return InfluxDBClientFactory.create(influxProperties.getUrl(), influxProperties.getToken().toCharArray(), influxProperties.getOrg(), influxProperties.getBucket());
	}

}
